package pattern;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by User on 2017/10/27.
 */
public class Test {
    public static void main(String[] args) {
        String msg = "^^0212H||||||||";

        Pattern p = Pattern.compile("\\^\\^[A-Za-z0-9]+\\|{8}");
        Matcher m = p.matcher(msg);
        StringBuffer sb = new StringBuffer();
        while (m.find()) {
            m.appendReplacement(sb, m.group().replace("H", ""));
        }
        m.appendTail(sb);
        System.out.println(sb.toString());



    }
}
